<extend name="./main"/>
<block name="title">
    <title>qzone后台----日志管理</title>
</block>
<block name="main">
<script src="__PUBLIC__/js/jquery.min.js"></script>
<div class="col-md-10 col-md-offset-1">
    <div class="panel-body" id="loglist">
        <h1 class="text-center mtop35"><a href="#">{$log.title}</a></h1>
        <p class="text-center auth-row">
            By <a href="#">{$user.nickname}</a>   |   {$log.ctime|date="Y-m-d H:i:s",###}   | <a href="#">返回日志列表</a>
        </p>
        <p>
            {$log.content}
        </p>

        <div class="blog-tags">
            <div class="pull-right tag-social">
                <a href="{:U('index')}" class="btn btn-share pull-right">返回</a>
                <a href="javascript:void(0)" class="btn btn-share pull-right action" dataid="{$log.id}" state="{$log['state']}">{$log['state']?'恢复':'删除'}</a>
            </div>
        </div>
    </div>
</div>
<div class="clear"></div>
<script>
    $('#loglist').on('click','.action',function(){
        debugger;
        var self = $(this);
        var id = self.attr('dataid');
        var state = self.attr('state');
        var url;
        if(state==4){
            url = "{:U('back')}";
        }else{
            url = "{:U('del')}";
        }
        $.ajax({
            type:'POST',
            url:url,
            data:{'id':id},
            datatype:'json',
            success:function(rs){
                if(rs.status == 'success'){
                    self.attr('state',rs.state);
                    self.html(rs.str);
                }else{
                    alert(rs.msg);
                }
            }
        });
    });
</script>

</block>